package com.niubility.server.Impl;


import com.niubility.dao.CollegeDao;
import com.niubility.entity.College;
import com.niubility.server.IColService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("collegeService")
public class CollegeService implements IColService {
    @Autowired
   private CollegeDao collegeDao;

    //根据高校ID获取高校数据
    public College loadByColId(int colId){
        return collegeDao.loadByColId(colId);
    }

    //根据高校名字获取高校数据
    public College loadByColName(String colName) {
        College college=collegeDao.loadByColName(colName);
        return college;
    }


    //获取全部指定数量的高校数据，按社团数量排序
    public List<College> loadHotCol(int hotColCounts) {
        List<College> collegeList=collegeDao.loadHotCollege(hotColCounts);
        return collegeList;
    }


    //自动修改高校社团数量
    public boolean updateColDeps(int colId,int changeValue){
        int i=collegeDao.updateColDeps(colId,changeValue);
        //System.out.println("大学表更新成功！");
        return i>0?true:false;
    }



}
